package com.example.demo;


import org.springframework.web.bind.annotation.*;

@RestController

@RequestMapping("/hello")
public class test {

    @RequestMapping("/v1")
    public String v1() {
        return "hello v1 ~~";
    }

    @RequestMapping("/v2")
    public String v2() {
        return "hello v2 ~~";
    }

    //仅支持GET请求
    @GetMapping("/v3")
    public String v3() {
        return "hello v3(我仅支持GET请求)";
    }

    @RequestMapping(value = "/v4" , method = RequestMethod.GET)
    public String v4() {
        return "hello v4(我仅支持GET请求)";
    }

    //仅支持POST请求
    @PostMapping("/v5")
    public String v5() {
        return "hello v5(我仅支持POST请求)";
    }

    @RequestMapping(value = "/v6" , method = RequestMethod.POST)
    public String v6() {
        return "hello v6(我仅支持POST请求)";
    }

    //POST方法和GET方法路径相同
    @GetMapping("/v7")
    public String v7() {
        return "hello v7(GET方法的)";
    }

    @PostMapping("/v7")
    public String v8() {
        return "hello v8(POST方法的)";
    }
}
